//package com.yangye.cloud.demo.order.scheduler;
//
//import com.alibaba.fastjson.JSON;
//import com.yangye.cloud.demo.order.domain.Event;
//import com.yangye.cloud.demo.order.domain.Order;
//import com.yangye.cloud.demo.order.enums.EventTypeEnum;
//import com.yangye.cloud.demo.order.mapper.EventMapper;
//import lombok.SneakyThrows;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.scheduling.annotation.Scheduled;
//import org.springframework.stereotype.Component;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.util.List;
//
///**
// * @author yangye
// * @date 2020/10/30
// */
//@Component
//public class OrderScheduler {
//
//	@Autowired
//	private EventMapper eventMapper;
//
//	@SneakyThrows
//	@Scheduled(cron = "*/5 * * * * ?")
//	@Transactional
//	public void scheduledTask() {
//		// 查询出所有状态为已接受状态的事件
//		Event query = new Event();
//		query.setEventType(EventTypeEnum.RECEIVED.getCode());
//
//		List<Event> list = eventMapper.select(query);
//		for (Event event : list) {
//			// 更新事件表状态为已处理
//			event.setEventType(EventTypeEnum.PROCESSED.getCode());
//			eventMapper.updateByPrimaryKey(event);
//			// TODO:更新订单表状态为已支付
//		}
//	}
//}
